package com.wy.powerbuilder.mapper.ljh;
import com.wy.powerbuilder.entity.ljh.Device;
import com.wy.powerbuilder.entity.ljh.Repair;
import com.wy.powerbuilder.entity.lwg.houses;
import org.apache.ibatis.annotations.*;


import java.util.List;
@Mapper
public interface RepairMapper {
    List<Repair> selAll(String r_userName);
    @Insert("insert into repair values(null,#{r_userName},#{r_state},#{r_number},#{r_date},#{r_goodcost},#{r_serve},#{r_empoyee},null,#{r_remarks})")
    int addRepair(Repair repair);
    @Delete("delete from repair where r_id=#{r_id}")
    int delRepair(Integer r_id);
    @Update("update repair set  r_userName=#{r_userName},r_state=#{r_state},r_number=#{r_number},r_date=#{r_date},r_goodcost=#{r_goodcost},r_serve=#{r_serve},r_empoyee=#{r_empoyee},r_endDate=#{r_endDate},r_remarks=#{r_remarks} where r_id=#{r_id} ")
    int updRepair(Repair repair);
    @Select("select * from repair where r_id=#{r_id}")
    Repair selectId(Integer r_id);
    @Select("select * from houses")
    List<houses> seleAll();
    @Select("select * from device")
    List<Device> showDevice();
    @Select("SELECT SUM(r_goodcost) FROM `repair` WHERE r_date LIKE'%2019%'")
    int sum();
}